import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import sakura from 'vuepress-plugin-sakura'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
    sakura({
      num: 20,  // Number of sakura petals
      show: true,  // Whether to show
      zIndex: -1,  // Z-index
      img: {
        replace: false,  // Use default image or replace
        httpUrl: ''  // URL for custom image if replace is true
      }
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  server: {
    fs: {
      allow: ['..', 'public']
    },
    host: true,
    port: 5173,
    hmr: {
      host: 'luckyzhou.online',
      port: 5173,
    }
  },
  base: '/'
})
